mastodon_api\methods\admin/
reports.rs

1use crate::MastodonClient;
2use crate::error::Result;
3
4/// Handler for admin report management API endpoints.
5pub struct AdminReportsHandler<'a> {
6    client: &'a MastodonClient,
7}
8
9impl<'a> AdminReportsHandler<'a> {
10    pub fn new(client: &'a MastodonClient) -> Self {
11        Self { client }
12    }
13
14    /// Fetches all reports (admin view).
15    pub async fn list(&self) -> Result<serde_json::Value> {
16        let url = format!("{}/api/v1/admin/reports", self.client.base_url());
17        let req = self.client.http_client().get(&url);
18        self.client.send(req).await
19    }
20
21    /// Resolves a report.
22    pub async fn resolve(&self, id: &str) -> Result<()> {
23        let url = format!(
24            "{}/api/v1/admin/reports/{}/resolve",
25            self.client.base_url(),
26            id
27        );
28        let req = self.client.http_client().post(&url);
29        self.client.send(req).await
30    }
31}